EXTERN_C_START

NTSTATUS IVSHMEMQueueInitialize(_In_ WDFDEVICE Device);

EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL IVSHMEMEvtIoDeviceControl;
EVT_WDF_IO_QUEUE_IO_STOP           IVSHMEMEvtIoStop;
EVT_WDF_FILE_CLEANUP               IVSHMEMEvtDeviceFileCleanup;

EXTERN_C_END

#define WRITE_DATA_TO_REGISTER(_arr, _off, _type) do {                                        \
    _type dataBuff = 0;                                                                       \
    for (int i = 0; i < sizeof(_type); i++) { dataBuff |= (_type)(_arr)[i] << (i << 3); }     \
    WRITE_REGISTER_## _type((_type *)&DeviceContext->devRegisters->reserved[_off], dataBuff); \
} while (0)

#define READ_DATA_FROM_REGISTER(_arr, _off, _type) do {                                              \
    _type _dataBuff = READ_REGISTER_## _type((_type *)&DeviceContext->devRegisters->reserved[_off]); \
    for (int i = 0; i < sizeof(_type); i++) {                                                        \
        (_arr)[i] = _dataBuff & 0xff;                                                                \
        _dataBuff >>= 8;                                                                             \
    }                                                                                                \
} while (0)
